#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include<QHostInfo>
#include<QTcpSocket>
#include<QTcpServer>
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    //获取本地ip地址函数
    QString GetLocalIP();
public slots:


private slots:
    void on_StartServerbtn_clicked();

    void on_StopServerbtn_clicked();

    void on_SendMessageBtn_clicked();
    //客户端连接
    void clientConnect();
    //客户端断开
    void clienxtDisConnect();
    //读取客户端发售那个数据
    void ReadClientMessage();

    void newconnection1();

private:
    Ui::MainWindow *ui;
    QTcpSocket *socket;
    QTcpServer *tcpserver;
    QString ip;


};
#endif // MAINWINDOW_H
